package www.openteam.com.presenter.realtime;

import java.util.HashMap;
import java.util.List;

import www.openteam.com.base.BasePresenter;
import www.openteam.com.bean.ProStock;
import www.openteam.com.contract.realtime.StockContract;
import www.openteam.com.model.realtime.StockModel;
import www.openteam.com.mvp.IModel;
import www.openteam.com.ui.realtime.StockFragment;

/**
 * Created by kylin on 2017/1/5.
 */

public class StockPresenter extends BasePresenter<StockFragment> implements StockContract.StockPresenter {
    @Override
    public HashMap<String, IModel> getiModelMap() {
        return loadModelMap(new StockModel());
    }

    @Override
    public HashMap<String, IModel> loadModelMap(IModel... models) {

        HashMap<String,IModel> hashMap =new HashMap<>();

        hashMap.put("queryStock",models[0]);


        return hashMap;
    }

    @Override
    public void queryStock(String rdsno, String stype, int PageSize) {

        ((StockModel) getiModelMap().get("queryStock"))
                .queryStock(rdsno,stype, PageSize, new StockModel.StockOnListener() {
                    @Override
                    public void querySSuccess(List<ProStock.DataEntity> produce) {

                        getIView().querySSuccess(produce);
                    }

                    @Override
                    public void querySFail(String failMsg) {

                        getIView().querySFail(failMsg);
                    }
                });


    }
}
